/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#include "umc_defs.h"
#if defined(UMC_ENABLE_AVS_VIDEO_DECODER)

#include "umc_avs_dec_tables.h"

namespace UMC
{

const
AVS_MB_TYPE TypesOfPMacroblocks[6] =
{
    {P_Skip,    Div_16x16,  0},
    {P_16x16,   Div_16x16,  1},
    {P_16x8,    Div_16x8,   2},
    {P_8x16,    Div_8x16,   2},
    {P_8x8,     Div_8x8,    4},
    {I_8x8,     Div_16x16,  0}
};

const
AVS_B_MB_TYPE TypesOfBMacroblocks[25] =
{
    {B_Skip,            Div_16x16,  0,  PredBiDir,      PredBiDir,      PredBiDir,      PredBiDir},
    {B_Direct_16x16,    Div_16x16,  0,  PredBiDir,      PredBiDir,      PredBiDir,      PredBiDir},
    {B_Fwd_16x16,       Div_16x16,  1,  PredForward,    PredForward,    PredForward,    PredForward},
    {B_Bck_16x16,       Div_16x16,  1,  PredBackward,   PredBackward,   PredBackward,   PredBackward},
    {B_Sym_16x16,       Div_16x16,  1,  PredSym,        PredSym,        PredSym,        PredSym},
    {B_Fwd_Fwd_16x8,    Div_16x8,   2,  PredForward,    PredForward,    PredForward,    PredForward},
    {B_Fwd_Fwd_8x16,    Div_8x16,   2,  PredForward,    PredForward,    PredForward,    PredForward},
    {B_Bck_Bck_16x8,    Div_16x8,   2,  PredBackward,   PredBackward,   PredBackward,   PredBackward},
    {B_Bck_Bck_8x16,    Div_8x16,   2,  PredBackward,   PredBackward,   PredBackward,   PredBackward},
    {B_Fwd_Bck_16x8,    Div_16x8,   2,  PredForward,    PredForward,    PredBackward,   PredBackward},
    {B_Fwd_Bck_8x16,    Div_8x16,   2,  PredForward,    PredBackward,   PredForward,    PredBackward},
    {B_Bck_Fwd_16x8,    Div_16x8,   2,  PredBackward,   PredBackward,   PredForward,    PredForward},
    {B_Bck_Fwd_8x16,    Div_8x16,   2,  PredBackward,   PredForward,    PredBackward,   PredForward},
    {B_Fwd_Sym_16x8,    Div_16x8,   2,  PredForward,    PredForward,    PredSym,        PredSym},
    {B_Fwd_Sym_8x16,    Div_8x16,   2,  PredForward,    PredSym,        PredForward,    PredSym},
    {B_Bck_Sym_16x8,    Div_16x8,   2,  PredBackward,   PredBackward,   PredSym,        PredSym},
    {B_Bck_Sym_8x16,    Div_8x16,   2,  PredBackward,   PredSym,        PredBackward,   PredSym},
    {B_Sym_Fwd_16x8,    Div_16x8,   2,  PredSym,        PredSym,        PredForward,    PredForward},
    {B_Sym_Fwd_8x16,    Div_8x16,   2,  PredSym,        PredForward,    PredSym,        PredForward},
    {B_Sym_Bck_16x8,    Div_16x8,   2,  PredSym,        PredSym,        PredBackward,   PredBackward},
    {B_Sym_Bck_8x16,    Div_8x16,   2,  PredSym,        PredBackward,   PredSym,        PredBackward},
    {B_Sym_Sym_16x8,    Div_16x8,   2,  PredSym,        PredSym,        PredSym,        PredSym},
    {B_Sym_Sym_8x16,    Div_8x16,   2,  PredSym,        PredSym,        PredSym,        PredSym},
    // block prediction types for the following macroblock are parsed from the bitstream
    {B_8x8,             Div_8x8,    0,  PredIntra,      PredIntra,      PredIntra,      PredIntra},
    {I_8x8,             Div_8x8,    0,  PredIntra,      PredIntra,      PredIntra,      PredIntra}
};

const
Ipp32u CBPOfMacroblock[AVS_CODING_TYPES][64] =
{
    {
        63, 15, 31, 47, 0,  14, 13, 11,
        7,  5,  10, 8,  12, 61, 4,  55,
        1,  2,  59, 3,  62, 9,  6,  29,
        45, 51, 23, 39, 27, 46, 53, 30,
        43, 37, 60, 16, 21, 28, 19, 35,
        42, 26, 44, 32, 58, 24, 20, 17,
        18, 48, 22, 33, 25, 49, 40, 36,
        34, 50, 52, 54, 41, 56, 38, 57
    },

    {
        0,  15, 63, 31, 16, 32, 47, 13,
        14, 11, 12, 5,  10, 7,  48, 3,
        2,  8,  4,  1,  61, 55, 59, 62,
        29, 27, 23, 19, 30, 28, 9,  6,
        60, 21, 44, 26, 51, 35, 18, 20,
        24, 53, 17, 37, 39, 45, 58, 43,
        42, 46, 36, 33, 34, 40, 52, 49,
        50, 56, 25, 22, 54, 57, 41, 38
    }
};

const
Ipp32u AVSChromaQPTable[64] =
{
   0,  1,  2,  3,  4,  5,  6,  7,
   8,  9, 10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23,
  24, 25, 26, 27, 28, 29, 30, 31,
  32, 33, 34, 35, 36, 37, 38, 39,
  40, 41, 42, 42, 43, 43, 44, 44,
  45, 45, 46, 46, 47, 47, 48, 48,
  48, 49, 49, 49, 50, 50, 50, 51
};

} // namespace UMC

#endif // defined(UMC_ENABLE_AVS_VIDEO_DECODER)
